<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>网页时钟</title>
    <script type="text/javascript">
        var weeks = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];

        function show() {
            var date = new Date();
            var year = date.getFullYear();
            var month = date.getMonth() + 1;
            var day = date.getDate();
            var hour = date.getHours();
            var min = date.getMinutes();
            var sec = date.getSeconds();
            var week = weeks[date.getDay()];
            document.getElementById("time").innerHTML = year + "年" + format(month) + "月" + format(day) + "日——" + format(hour) + ":" + format(min) + ":" + format(sec) + "——" + week;
        }

        function format(num) {
            if (num < 10) {
                num = '0' + num;
            }
            return num;
        }
    </script>
</head>
<body>
<div id="time"></div>
<script type="text/javascript">
    setInterval(show, 1000)
    show();
</script>
</body>
</html>